<!DOCTYPE html>
<html>

	<head>
		<meta name="viewport" content="width=device-width-10, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
		<meta charset="UTF-8">
		<link rel="icon" href="img/favicon.ico">
		<link rel="shortcut icon" href="img/favicon.ico">
		<meta name="keywords" content="简洁，强大的二维码软件,QRTools,QRT,二维码">
		<meta name="description" content="简洁，强大的二维码软件">

		<script type="text/javascript" src="js/jquery-2.1.0.js"></script>
		<script type="text/javascript" src="js/qrcode.js"></script>
		<script type="text/javascript" src="js/qrcode.min.js"></script>

		<script type="text/javascript" src="js/llqrcode.js"></script>
		<script type="text/javascript" src="js/analyticCode.js"></script>
		<script type="text/javascript" src="js/webqr.js"></script>

		<title>QRTools - 扫描二维码</title>

		<style type="text/css">
			body {
				margin: 0;
				padding: 0;
				background-color: #616161;
			}
			
			.view {
				margin: 20px;
				background-color: #ffffff;
				padding: 20px;
				text-align: center;
			}
			
			.view2 {
				margin: 20px;
				background-color: #ffffff;
				padding: 20px;
			}
			
			#img2 {
				box-shadow: 2px 2px 5px #616161;
			}
		</style>

	</head>

	<body>

		<div class="view">
			<h3>上传二维码解析</h3>
			<br />
			<img id="img2" style="width: 150px;height: 150px;" src="img/tu.png" />
			<br />
			<input type="file" onChange="getUrl(this,'file-url')" id="file" style="padding: 10px;background-color: gainsboro;margin-top: 20px;" />

		</div>

		<div class="view2" id="result_text">

			结果:null

		</div>

	</body>

	<script type="text/javascript">
		function getUrl(e, param) {
			document.getElementById("result_text").innerHTML = "解析中...";
			analyticCode.getUrl(param, e, function(url1, url2) {

				if(url1 == "error decoding QR Code") {
					document.getElementById("result_text").innerHTML = "二维码解析失败!";
					document.getElementById("img2").src = "img/err.png";
				} else if(url1 == "Failed to load the image") {
					document.getElementById("result_text").innerHTML = "未选择文件!";
					document.getElementById("img2").src = "img/tan.png";
				} else {
					document.getElementById("result_text").innerHTML = url1;
					document.getElementById("img2").src = url2;
				}

			});
		}


	</script>

</html>